using System;
using System.Diagnostics.Contracts;
using Microsoft.SharePoint;

namespace OpenWaves.ActivityFeed.Sharepoint
{
    public static class SPObjectExtensions
    {
        public static Topic AsTopic(this SPList list)
        {
            //Contract.Requires<ArgumentNullException>(list != null);

            return new Topic("SPList/" + list.ID);
        }
        
        public static Topic AsTopic(this SPWeb web)
        {
            //Contract.Requires<ArgumentNullException>(web != null);

            return new Topic("SPWeb/" + web.ID);
        }

        public static Topic AsTopic(this SPSite site)
        {
            //Contract.Requires<ArgumentNullException>(site != null);

            return new Topic("SPSite/" + site.ID);
        }

        public static Topic AsTopic(this SPUser user)
        {
            //Contract.Requires<ArgumentNullException>(user != null);

            return new Topic("SPUser/" + user.ID.ToString());
        }
    }
}